#!/usr/bin/env python
# -*- coding:utf-8 -*-

import wsgiref
from wsgiref.simple_server import make_server,demo_app
from webob import Response,Request,dec

"""
ip = '127.0.0.1'
port = 9999
server = make_server(ip,port,demo_app)
server.serve_forever()

server.server_close()
"""


@dec.wsgify
def app(request:Request) -> Response:
    print(request.method)
    print(request.path)
    print(request.query_string)
    print(request.GET)
    print(request.POST)
    print('params = {}'.format(request.params))

    res = Response("<h1> test wsgi</h1>")
    return res


if __name__=='__main__':
    ip = '127.0.0.1'
    port = 9999
    server = make_server(ip,port,app)
    server.serve_forever()

    server.server_close()